package com.jianneng.jdg.model.fragment;

import com.example.com.jianneng.jdg.R;
import com.jianneng.jdg.model.adapter.AskListAdapter;
import com.jianneng.jdg.model.gallery.AskListService;
import com.jianneng.jdg.model.homeactivity.MyConsultActivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class FragmentCircleAsk extends Fragment implements OnClickListener{
	private AskListAdapter mAdapter;
	private ListView  mAskListView;
	private RelativeLayout mMyConsult,mPhone;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		View view =  inflater.inflate(R.layout.fragment_circle_ask, container, false);
		mAskListView =(ListView) view.findViewById(R.id.ask_listview);
		mAdapter = new AskListAdapter(getActivity(), AskListService.getAsk());
		mAskListView.setAdapter(mAdapter);
		mMyConsult = (RelativeLayout) view.findViewById(R.id.my_consult);
		mMyConsult.setOnClickListener(this);
		mPhone = (RelativeLayout) view.findViewById(R.id.on_key_phone);
		return view;
	}
	
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		
		super.onActivityCreated(savedInstanceState);
		mPhone.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Toast.makeText(getActivity(), "想什么呢！！你想打就打啊sb!!", 1).show();
				
			}
		});
	}


	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.my_consult:
			Intent intent = new Intent(getActivity(),MyConsultActivity.class);
			startActivity(intent);
			break;

		default:
			break;
		}
		
	}

	
	
}
